package name.huzhenbo.java.patterns.composite;

import java.util.ArrayList;
import java.util.List;

class CompositeShape implements Shape {
    // Used only for test
    private static int COUNT = 0;

    private List<Shape> shapes = new ArrayList<Shape>();

    public void add(Shape shape) {
        shapes.add(shape);
        COUNT++;
    }

    public void draw() {
        for (Shape shape : shapes) {
            shape.draw();
        }
    }

    public static int count(){
        return COUNT;
    }
}
